<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head >
	<meta charset="UTF-8">
	<title></title>
	<link rel="stylesheet" th:href="@{/public/layui/css/layui.css}">
	<link rel="stylesheet" th:href="@{/public/validform/css/style.css}">
</head>

<body>
<div class="layui-fluid">
	<div class="layui-row" style="margin-bottom: 10px;">
				<span class="layui-breadcrumb">
				  <a href="">资源管理</a>
				  <a href=""><cite>友情链接</cite></a>
				</span>
	</div>
	<form class="layui-form registerform" action="/admin/linkConfig/save" th:object="${data.data}">
		<input type="hidden" name="id" th:value="*{id}">
		<div class="layui-form-item">
			<label class="layui-form-label">链接名称</label>
			<div class="layui-input-block">
				<input type="text" name="name" th:value="*{name}" datatype="*" nullmsg="链接名称不能为空！"  placeholder="请输入链接名称" class="layui-input">
				<div class="Validform_checktip"></div>

			</div>
		</div>

		<div class="layui-form-item">
			<label class="layui-form-label">地址</label>
			<div class="layui-input-block">
				<input type="text" name="url" th:value="*{url}" datatype="*" nullmsg="地址不能为空！"  placeholder="请输入地址" class="layui-input">
				<div class="Validform_checktip"></div>

			</div>
		</div>


		<div class="layui-form-item">
			<label class="layui-form-label">是否显示</label>
			<div class="layui-input-block">
                <span th:if="*{id} == null">
                    <input type="radio" name="isShow" value="1" title="是" checked="">
                    <input type="radio" name="isShow" value="0" title="否" >
                </span>
				<span th:if="*{id} != null">
                    <input type="radio" name="isShow" value="1" title="是" th:checked="*{isShow} eq 1">
                    <input type="radio" name="isShow" value="0" title="否" th:checked="*{isShow} eq 0">
                </span>
				<div class="Validform_checktip"></div>
			</div>
		</div>

		<div class="layui-form-item layui-form-text">
			<label class="layui-form-label">备注</label>
			<div class="layui-input-block">
				<textarea placeholder="请输入内容" name="remark" class="layui-textarea">[[*{remark}]]</textarea>
			</div>
		</div>

		<div class="layui-form-item">
			<div class="layui-input-block">
				<button class="layui-btn layui-btn-normal" id="btn_sub" lay-submit="" lay-filter="demo1">立即提交</button>
				<button type="button" onclick="closeWin()" class="layui-btn layui-btn-primary">关闭</button>
			</div>
		</div>
	</form>


</div>
<script type="text/javascript" th:src="@{/public/jquery/jquery-1.9.1.min.js}"></script>
<script type="text/javascript" th:src="@{/public/artDialog/jquery.artDialog.js(skin=blue)}"></script>
<script type="text/javascript" th:src="@{/public/artDialog/plugins/iframeTools.js}"></script>
<script type="text/javascript" th:src="@{/public/validform/Validform_v5.3.2_min.js}"></script>
<script th:src="@{/public/layui/layui.all.js}"></script>
<script type="text/javascript">
    //关闭窗口
    function closeWin(){
        art.dialog.close();
    }

    $(function(){

        //表单验证，采用异步提交
        $(".registerform").Validform({
            btnSubmit:"#btn_sub",
            tiptype:function(msg,o,cssctl){
                if(!o.obj.is("form")){//验证表单元素时o.obj为该表单元素，全部验证通过提交表单时o.obj为该表单对象;
                    var objtip=o.obj.siblings(".Validform_checktip");
                    cssctl(objtip,o.type);
                    objtip.text(msg);
                }
            },
            ajaxPost:true,
            callback:function(data){ //提交到服务器后回调的方法
                //返回数据data是json对象，{"info":"demo info","status":"y"}
                layui.use('layer', function(){
					layer.msg(data.msg,{time:1000},function () {
						if (data.status == 1) {
							//回调父页面方法
							art.dialog.opener.ajaxLoad();
							//关闭窗口
							art.dialog.close();
						}
					});
                });
            }
        });
    });

</script>
</body>

</html>